home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / maxsbbsus.lha / MAX154 / TBM / Txt / SmartDOS.txt < prev    next >
Text File  |  1995-09-29  |  6KB  |  140 lines

  1.  
  2.   
  3. (capture buffer on?  If not, hit "n", turn it on, come back here.  This may
  4. not look like much now, but some day you may REALLY want it.  This, and the
  5. file on FakeKey/MovePointer)
  6.   
  7.  
  8.   Okay, you've got a directory full of files, and you want to do the same
  9. operation to each of them.  Some examples might be:
  10.  
  11. > Editing a number of textfiles, then doing something to each of them after
  12. you're through, such as renaming them or copying a duplicate to a different
  13. directory.
  14.  
  15. > Compressing a number of files to individual LZX files.
  16.  
  17. > Converting other archive formats to LZX
  18.  
  19. > Adding a ReadMe file or something to a number of LZX files.
  20.  
  21. Really, any operation that you can list out as a standard Execute scriptfile,
  22. but this will allow you to do it to a large random number of files, rather
  23. than some specified list.
  24.  
  25.  
  26.   Let's take an easy example:  Let's say we have a bunch of pictures we want
  27. to compress to individual LZX files.  They're in our dh0:Files directory.
  28.   
  29.   Smart DOS uses the List command to list out the Files directory, and the
  30. "LFORMAT" option lists out a separate command line for each one.  The
  31. "<name>" wildcard will be the name of the next file on the list.  If we were
  32. making an Execute scriptfile, planning on doing this to just ONE file, it
  33. would look something like the following.  This could be done better, but for
  34. this example we'll just take it step-by-step:
  35.  
  36.  
  37.   MakeDir Ram:Temp                ;we'll do all the work here
  38.   CD Ram:Temp
  39.  
  40.   Copy dh0:Files/<name> Ram:Temp  ;copies the file to Ram:Temp
  41.   LZX a <name>                    ;compresses the file to <name>.LZX
  42.   Copy <name>.LZX dh0:Files       ;copies new LZX file back to hard drive
  43.   Delete #?                       ;deletes files in work area
  44.  
  45.  
  46.   Okay, with me so far?  Now check out the following.  To note is that the 
  47. Echo line is ONE line with your text editor, although it'll break into two 
  48. lines here.  This is a scriptfile that you Execute:
  49.  
  50. ----------------------
  51.  
  52. .k dev                    
  53. .def dev "Ram:"       
  54. .bra {                
  55. .ket }
  56.  
  57. MakeDir Ram:Temp
  58. CD Ram:Temp
  59.  
  60. List >Ram:x1 dh0:Files nohead quick LFORMAT "Execute Ram:x2 %s %s"
  61.  
  62. Echo >Ram:x2 ".k path,name*nCopy dh0:Files/<name> Ram:Temp*nLZX a <name>*n-
  63. Copy <name>.LZX dh0:Files*nDelete #?"
  64.  
  65. Execute Ram:x1             ;this is what actually does the work
  66.  
  67. ---------------------------
  68.  
  69.   Okay, you can kinda see what that did.  It listed out the files in
  70. dh0:Files, it kept the list `clean' with nohead and quick, and the LFORMAT
  71. executes the Echo line on each entry, with the whole mess being outputted to
  72. a scriptfile in Ram called x1 which is then Executed to do the actual work.
  73.  
  74.   The Echo command is ONE line, remember.  It should basically be what we had
  75. listed up above, with the little "*n" jobbies in between each command.  I
  76. guess the line can be as long as 255 characters, the max width of a DOS line.
  77. If you need it to be longer, I suppose you'd Execute sub-scriptfiles.
  78. Whether or not the sub-scripts would understand the "<name>" wildcard, I
  79. don't know.  But they "should".  <chuckle>
  80.  
  81.   The next improvement we make is using some generic directory heading for
  82. the directory the files are in, like "XXX:".  We "Assign dh0:Files: XXX:"
  83. before running the scriptfile.  This way we don't have to keep altering the
  84. file.  If the next directory of files to be worked on is "dh0:Files2", then
  85. just Assign that to "XXX:" before Executing the file again.
  86.  
  87.   So now it looks like this:
  88.  
  89. List >Ram:x1 XXX: nohead quick LFORMAT "Execute Ram:x2 %s %s"
  90.  
  91. Echo >Ram:x2 ".k path,name*nCopy XXX:<name> Ram:Temp*nLZX a <name>*n-
  92. Copy <name>.LZX XXX:*nDelete #?"
  93.  
  94.   That does the same thing as our original example, only now we can leave the
  95. scriptfile alone and just Assign whatever dir that needs work to "XXX:".
  96.  
  97.  
  98.   Following is an example of how to use sub-directories in all this, like if
  99. you're LZX'ing directories and sub-directories.  This converted my LHA files
  100. to LZX.  The LHA archives are in "XXX:", the path for the new LZX files is
  101. "YYY:".  
  102.  
  103. Note:  I use the old arp version of Copy as it handles wildcards better.
  104.  
  105. First, let's list them out so it'll look understandable:
  106.  
  107. LHA x XXX:<path><name>                ; extracts files from archive
  108. LZX -3 -m -r -x -e -Y a <name> #?     ; LZX does its thing
  109. copy #?.LHA.LZX YYY:#?.LZX            ; copies new LZX file to YYY:
  110. delete #? all"                        ; deletes everything in work area
  111.  
  112.   What you're noting are the "<path><name>" commands, the extended string for
  113. LZX, the "all" in "delete all" (to get any sub-dirs), and how "<name>" is
  114. going to be something like "BOOBIES.LHA", so when you LZX the "<name>", the
  115. LZX filename is going to be "BOOBIES.LHA.LZX".  That's why the odd look to
  116. the copy command.  You can try your C= Copy command, just keep the arp one in
  117. mind if it doesn't work.  I also use the arp Rename command as a general
  118. rule.
  119.  
  120. In clever SmartDOS, that'd be:
  121.  
  122. List >Ram:x1 XXX: nohead quick lformat "execute Ram:x2 %s %s"
  123.  
  124. Echo >Ram:x2 ".k path,name*nLHA x XXX:<path><name>*nLZX -3 -m -r -x -e -Y a
  125. <name> #?*ncopy #?.LHA.LZX YYY:#?.LZX*n delete #? all"
  126.  
  127.   Basically, once you get it going for one operation, you just keep a Master
  128. kicking around somewhere, and when you want to do something different in the
  129. future, just plug in the different pathnames and commands.  I just used one
  130. the other day where I had it Executing a FakeKey/MovePointer file in each go-
  131. around, converting my file descriptions to file_id.diz files, pretty cool.
  132.  
  133.   Any questions, give a holler. 
  134.  
  135.   - TBM
  136.                      
  137.  (capture buffer off?) 
  138.  
  139.       
  140. %Z